<?php

$file = (isset($_REQUEST['file'])) ? $_REQUEST['file'] : false;
$act = (isset($_REQUEST['act'])) ? $_REQUEST['act'] : 'detail';

?>


<div class="filemanager">
	<div class="folders">
		<ul class="folders_nav clearfix">
			<li><?php $module->printDropdown($file); ?></li>
			<li><a href="#" class="ff_refresh" title="<?php $lang->put('refresh'); ?>"><img src="<?php echo $cosa->system('base-url'); ?>/kernel/files/img/icons/m/refresh.gif" alt="<?php $lang->put('refresh'); ?>" /></a></li>
			<li><a href="#" class="ff_add_folder" title="<?php $lang->put('add-folder'); ?>"><img src="<?php echo $cosa->system('base-url'); ?>/kernel/files/img/icons/m/add_folder.gif" alt="<?php $lang->put('add-folder'); ?>" /></a></li>
			<li><a href="#" class="ff_add_file" title="<?php $lang->put('add-file'); ?>"><img src="<?php echo $cosa->system('base-url'); ?>/kernel/files/img/icons/m/add_file.gif" alt="<?php $lang->put('add-file'); ?>" /></a></li>
		</ul>
		<div id="folders">
			<?php $module->printFilesFolders($file); ?>
		</div>
	</div>
	<div class="files">
		<div id="files">
			<?php
			
			switch($act) {
				
				case 'add':
					if(isset($_POST['addSbm'])) {
						$module->addFile($postVars);
						$module->getDetail($file);
					} else {
						include ROOT_PATH.$cosa->system('modules-path').'/filemanager/view/inc_add.php';
					}
					break;
				
				case 'edit':
					if(isset($_POST['editSbm'])) {
						$edit = $module->editFile($postVars);
						$msg = ($edit) ? $lang->get('edit-file-success') : $lang->get('edit-file-failed');
						$modules->addMessage($msg);
						$module->getDetail($file);
					} else {
						include ROOT_PATH.$cosa->system('modules-path').'/filemanager/view/inc_edit.php';
					}
					break;
				
				case 'del':
					$module->delFile($file);
					$module->getDetail();
					break;
				
				case 'resize':
					include ROOT_PATH.$cosa->system('modules-path').'/filemanager/view/inc_resize.php';
					break;
				
				case 'detail':
				default:
					$module->getDetail($file);
					break;
				
			}
			
			?>
		</div>
	</div>
</div>
